package com.softeem;

import com.softeem.demo1.Student1;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/4/1 14:18
 * @description
 */
public class ArrayListDemo1 {

    public static void arrayListTest(){
        ArrayList<Object> list = new ArrayList<>();
        list.add("London");
        list.add(110);
        list.add(new Student1());
        list.add(100.11);
        list.add(3,"beijing");
        list.remove(1);
        int size = list.size();
        for (int i = 0; i < size; i++) {
            Object o = list.get(i);
            System.out.println(o);
        }
        System.out.println("========================");
        Iterator<Object> it = list.iterator();
        while (it.hasNext()){
            Object next = it.next();
            System.out.println(next);
        }
        System.out.println("========================");
        for (Object o : list) {
            System.out.println(o);
        }

    }
    public static void main(String[] args) {
        arrayListTest();
    }
}
